home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
An Invitation to the Roland World of Music
/
Roland - An Invitation To The Roland World Of Music.bin
/
vb
/
mmsystem
/
msgblst1
/
main.frm
< prev
next >
Wrap
Text File
|
1995-05-30
|
3KB
|
115 lines
VERSION 2.00
Begin Form frm_main
Caption = "MIDI Thru"
ClientHeight = 3150
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 3420
Height = 3555
Left = 1035
LinkTopic = "Form2"
ScaleHeight = 3150
ScaleWidth = 3420
Top = 1140
Width = 3540
Begin ListBox lst_OUT_dev
Height = 810
Left = 180
TabIndex = 2
Top = 1920
Width = 2895
End
Begin ListBox lst_IN_dev
Height = 810
Left = 180
TabIndex = 1
Top = 840
Width = 2895
End
Begin CheckBox chk_thru
Caption = "Thru"
Height = 315
Left = 240
TabIndex = 0
Top = 240
Width = 855
End
Begin MsgBlaster MsgBlaster1
Prop8 = "Click on ""..."" for the About Box ---->"
Prop9 = "Click on ""..."" for the Message Center --->"
Left = 2760
MsgList = MAIN.FRX:0000
MsgPassage = MAIN.FRX:0064
TargetName = ""
Top = 240
UserMsgs = MAIN.FRX:0096
Version = "2.2"
End
Begin Label lbl_message
AutoSize = -1 'True
Caption = "Message:"
Height = 195
Left = 1320
TabIndex = 3
Top = 300
Width = 825
End
End
Option Explicit
' This is a example of using MsgBlast to "record" midi messages.
Sub chk_thru_Click ()
If chk_thru.Value = 1 Then ' Checked
' Open devices on check
If midi_out_open() Then
If midi_in_open(Me.hWnd) Then 'Send all incoming MIDI messages to this form (Me)
midi_start_rec
End If
End If
Else ' Unchecked
' Close devices on uncheck
midi_stop_rec
midi_in_close
midi_out_close
End If
End Sub
Sub Form_Load ()
' Fill listboxes
init_combo_dev_in lst_IN_dev
init_combo_dev_out lst_OUT_dev
' Start trapping of messages to this form (Me)
MsgBlaster1.hWndTarget = Me.hWnd
MsgBlaster1.MsgList(0) = MM_MIM_DATA ' Trap only this message
End Sub
Sub Form_Unload (Cancel As Integer)
' CLose devices (if still open)
midi_in_close
midi_out_close
' Stop trapping
MsgBlaster1.hWndTarget = 0
End Sub
Sub lst_IN_dev_Click ()
' Tell the MIDI_IN_MODULE what device to open (On next THRU click)
Call midi_in_set_dev(lst_IN_dev.ItemData(lst_IN_dev.ListIndex))
End Sub
Sub lst_OUT_dev_Click ()
' Tell the MIDI_OUT_MODULE what device to open (On next THRU click)
Call midi_out_set_dev(lst_OUT_dev.ItemData(lst_OUT_dev.ListIndex))
End Sub
Sub MsgBlaster1_Message (MsgVal As Integer, wParam As Integer, lParam As Long, ReturnVal As Long)
' Send inncoming MIDI message to MIDI OUT
Call midi_outshort_raw(lParam)
If lParam <> 248 And lParam <> 254 Then ' Filter timing messages
lbl_message.Caption = "Message: " & Hex(lParam)
' Remember that "first" MIDI byte is LSB, so the message must be read "backwards"
End If
End Sub